﻿using System;
using System.Collections.Generic;
using System.Text;

namespace NVR.BLL
{
    public class DeviceInfo
    {
        private DALFactory.DALFactory dataFactory = DataProvider.DefaultProvider;
        public List<Entity.DeviceInfo> GetPages(int currentPage,int pageSize,out int counts,out int pageNums)
        {
            return dataFactory.DALDeviceInfoProvider.PartPageFunc(currentPage, pageSize, out counts, out pageNums);
        }

        public int Delete(string sn)
        {
            Entity.DeviceInfo devInfo = new Entity.DeviceInfo();
            devInfo.Sn = sn;
            return dataFactory.DALDeviceInfoProvider.Delete(devInfo);
        }

        public Entity.DeviceInfo GetDeviceInfo(string sn)
        {
            List<Entity.DeviceInfo> list = dataFactory.DALDeviceInfoProvider.LoadBySn(sn);
            if (list.Count == 0)
            {
                return null;
            }
            return list[0];
        }
    }
}
